﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using Business;
using Domain;

namespace HotelBrisayArena
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {

        ImagenBusiness imgBusiness = new ImagenBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
        PublicidadBusiness publicidadBusiness = new PublicidadBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
        Imagen imagen = new Imagen();
        Imagen imagen2 = new Imagen();
        Publicidad publicidad = new Publicidad();

        protected void Page_Load(object sender, EventArgs e)
        {
            imagen = imgBusiness.GetImagen(13);
            byte[] imageBytes = imagen.Image;
            string base64ImageString = ConvertBytesToBase64(imageBytes);
            Image2.Src = "data:image/jpg;base64," + base64ImageString;
           

            publicidad = publicidadBusiness.GetPublicidad(1);
            imagen2 = imgBusiness.GetImagen(publicidad.Imagen.IdImagen);
            byte[] imageBytes2 = imagen2.Image;
            string base64ImageString2 = ConvertBytesToBase64(imageBytes2);
            Image1.Src = "data:image/jpg;base64," + base64ImageString2;
            HyperLink1.NavigateUrl = publicidad.Enlace;
        
        }

        public string ConvertBytesToBase64(byte[] imageBytes)
        {
            return Convert.ToBase64String(imageBytes);
        }
    }
}
 

         
                
                